<?php

class Inc {

    /**
     * 
     * @public _path
     */
    public $_path;
    public $_errorCode;

    /**
     * Public function _path
     * @return _path|void
     * @param  mixed|void $val
     */
    public function _path($val = false) {
        if ($val)
            $this->_path = $val;
        else
            return $this->_path;
    }
    /**
     * Public function _errorCode
     * @return _errorCode|void
     * @param  mixed|void $val
     */
    public function _errorCode($key = false) {
        $this->_errorCode = array();
        $this->_errorCode[1] = "%s Not found";
        return $this->_errorCode[$key];
    }

    /* constructor method */

    public function __construct($path = false) {
        $this->_path($path ? $path : false);
        //add your code here
    }

    public function qInclude($file = "") {
        $file = $this->_path() ? $this->_path() . $file : $file;
        if (file_exists($file)) {
            include_once $file;
        }else{
            $key = "1";
            $this->errorPage($key, $file);
        }
    }
    
    public function errorPage($errorCode, $file){
        global $_Q_Url;
        $message = $this->_errorCode($errorCode);
        $message = printf($message, $file);
        header("location: {$_Q_Url->_base()->url}404.php");
    }
}

?>
